{$CLEO .qa}
{$USE CLEO+}
{$USE newOpcodes}
{$USE ini}

0000: NOP

script_name "BRIDST"

// By ArtemQa146

const
    Chef_1 = 31@
    obj_1 = 30@
    Ped_ID = 29@
    coords_x = 28@
    coords_y = 27@
    coords_z = 26@
    angle_1 = 25@
    Ped_ID_2 = 24@
    Chef_2 = 23@
    progress = 22@
    render_obj = 0@
    render_obj_2 = 21@
    obj_2 = 20@
end


                Ped_ID = 260
                Ped_ID_2 = 153

                0087: coords_x = 0@ // (float)
                0087: coords_y = 1@ // (float)
                0087: coords_z = 2@ // (float)
                0087: angle_1 = 3@ // (float)
                0085: render_obj = 4@ // (int)
                0085: render_obj_2 = 5@ // (int)

                repeat
                wait 0
                04ED: load_animation  "PedEventsMod"
                until 04EE:   animation "PedEventsMod" loaded

                if not Ped_ID > 0
                then Ped_ID = 260
                end
                
                if not Ped_ID > 0
                then Ped_ID = 260
                end

                model.Load(Ped_ID)
                if
                    not model.Available(Ped_ID)
                then
                    repeat
                    wait 0
                    model.Load(Ped_ID)
                    until model.Available(Ped_ID)
                end
                model.Load(Ped_ID_2)
                if
                    not model.Available(Ped_ID_2)
                then
                    repeat
                    wait 0
                    model.Load(Ped_ID_2)
                    until model.Available(Ped_ID_2)
                end
                038B: load_requested_models

                009A: Chef_1 = create_actor_pedtype 4 model Ped_ID at coords_x coords_y coords_z
                0173: set_actor Chef_1 Z_angle_to angle_1

                0F02: create_render_object_to_char_bone_from_special Chef_1 special_model render_obj bone 24 offset 0.06 0 0 rotation 0 180.0 90.0 store_to obj_1
                0E37: set_render_object_scale obj_1 1.4 1.4 1.4
                0812: AS_actor Chef_1 perform_animation "br_idl_st_1" IFP "PedEventsMod" framedelta 100.0 loopA 1 lockX 0 lockY 0 lockF 0 time -1  // versionB
                0E24: fix_char Chef_1 ground 1 brightness 1 and_fade_in 0
                
                04C4: store_coords_to 1@ 2@ 3@ from_actor Chef_1 with_offset 1.7 0.0 0.0
                009A: Chef_2 = create_actor_pedtype 4 model Ped_ID_2 at 1@ 2@ 3@
                0173: set_actor Chef_2 Z_angle_to angle_1
                
                0F02: create_render_object_to_char_bone_from_special Chef_2 special_model render_obj_2 bone 34 offset 0.25 0 0 rotation 0 180.0 350.0 store_to obj_2
                0812: AS_actor Chef_2 perform_animation "crime_c2" IFP "PedEventsMod" framedelta 100.0 loopA 1 lockX 0 lockY 0 lockF 0 time -1  // versionB
                0E24: fix_char Chef_2 ground 1 brightness 1 and_fade_in 0

                model.Destroy(Ped_ID)
                model.Destroy(Ped_ID_2)
                
                timera = 15000

                repeat
                wait 0
                if and
                    056D:   actor Chef_1 defined
                    056D:   actor Chef_2 defined
                then
                

                    0E40: get_current_hour 1@
                    if
                        1@ >= 21
                    then
                        break
                    end

                    080E: get_actor Chef_1 ped_event_to 1@
                    if or
                        1@ == 49
                        1@ == 9
                        1@ == 15
                        1@ == 31
                        1@ == 59
                    then
                        break
                    end
                    
                    080E: get_actor Chef_2 ped_event_to 1@
                    if or
                        1@ == 49
                        1@ == 9
                        1@ == 15
                        1@ == 31
                        1@ == 59
                    then
                        break
                    end

                    if or
                        0118:   actor Chef_1 dead
                        0118:   actor Chef_2 dead
                        not locate_char_distance_to_char $player_actor char Chef_1 radius 150.0
                        not $ACTIVE_INTERIOR == 0
                        051A:   actor Chef_1 damaged_by_actor $PLAYER_ACTOR
                        not is_char_script_controlled Chef_1
                        051A:   actor Chef_2 damaged_by_actor $PLAYER_ACTOR
                        not is_char_script_controlled Chef_2
                    then
                        break
                    end

                    if or
                        0457:   player $PLAYER_CHAR aiming_at_actor Chef_1
                        0457:   player $PLAYER_CHAR aiming_at_actor Chef_2
                    then
                        0E83: get_current_char_weaponinfo $PLAYER_ACTOR store_to 1@
                        0E89: get_weaponinfo_fire_type 1@ store_to 2@ //     
                        if or
                            2@ == 1 //  
                            2@ == 3 //   (  ..)
                        then
                            break
                        end
                    end
                    
                    if
                        timera > 15000
                    then
                        if
                            locate_char_distance_to_char $player_actor char Chef_1 radius 15.0
                        then
                            timera = 0
                            0615: define_AS_pack_begin 1@
                            0812: AS_actor -1 perform_animation "br_idl_st_2" IFP "PedEventsMod" framedelta 2.0 loopA 0 lockX 0 lockY 0 lockF 0 time -1  // versionB
                            0812: AS_actor -1 perform_animation "br_idl_st_1" IFP "PedEventsMod" framedelta 2.0 loopA 1 lockX 0 lockY 0 lockF 0 time -1  // versionB
                            0616: define_AS_pack_end 1@
                            0618: assign_actor Chef_1 to_AS_pack 1@
                            061B: remove_references_to_AS_pack 1@
                        end
                    end

                end
                until not player.Defined(0)

                if 056D:   actor Chef_1 defined
                then 01C2: remove_references_to_actor Chef_1 // Like turning an actor into a random pedestrian
                end
                if 056D:   actor Chef_2 defined
                then 01C2: remove_references_to_actor Chef_2 // Like turning an actor into a random pedestrian
                end
                04EF: release_animation "PedEventsMod"

                repeat
                wait 0
                until not locate_char_distance_to_coordinates $PLAYER_ACTOR pos coords_x coords_y coords_z radius 150.0

0A93: terminate_this_custom_script
